#ifndef DB_H_
#define DB_H_

#include <QtGui>
#include <libpq-fe.h> 

class db {
	private:
		PGconn *psql;
		bool connected;
	public:
		db();
		int connectToDb(const char * dbname,const  char * user,const  char * pass);
		QStringList getWellList();
		QStringList getMastersList();
		void disconnectFromDb();
		int executeQuery(QString);
		void saveLetterInDB(int weelId,int idSimulador, QStringList letter);
		QStringList getHistoricFromWell(int,int);
		QString getUserLevel(QString);
	private:
		int getWellPK(int,int);
		QStringList getPaintOfDbLetter(QString);
		int NumberOfDigits(int);
};


#endif
